package yaner.hotel.manager.resource.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import yaner.hotel.manager.common.dto.menu.MenuAddDto;
import yaner.hotel.manager.common.dto.menu.MenuDto;
import yaner.hotel.manager.common.dto.menu.MenuUpdateDto;
import yaner.hotel.manager.common.dto.room.RoomAddDto;
import yaner.hotel.manager.common.dto.room.RoomDto;
import yaner.hotel.manager.common.dto.room.RoomUpdateDto;
import yaner.hotel.manager.common.vo.MenuVo;
import yaner.hotel.manager.common.vo.ResponseVo;
import yaner.hotel.manager.common.vo.RoomVo;
import yaner.hotel.manager.common.vo.SelectOptionVo;
import yaner.hotel.manager.resource.service.IMenuService;

import java.util.List;

/**
 * @Author kf-leig
 * @Description: 菜单管理
 * @Version 1.0
 * @Date 2024年05月22日11:31:00
 */
@RestController
public class MenuController {
    @Autowired
    private IMenuService menuService;
    @PostMapping("menu-list")
    public ResponseVo<List<MenuVo>> menuList(@RequestBody MenuDto MenuDto){
        List<MenuVo> MenuVos = menuService.menuList(MenuDto);
        return ResponseVo.success(MenuVos);
    }

    @PostMapping("select-menu-list")
    public ResponseVo<List<SelectOptionVo>> selectMenuList(@RequestBody MenuDto MenuDto){
        List<SelectOptionVo> selectOptionVoList = menuService.selectMenuList(MenuDto);
        return ResponseVo.success(selectOptionVoList);
    }

    @GetMapping("get-menu-info")
    public ResponseVo<MenuVo> getMenuInfo(@RequestParam("menuId") String MenuId){
        MenuVo MenuVo = menuService.getMenuInfo(MenuId);
        return ResponseVo.success(MenuVo);
    }

    @PostMapping("add-menu-info")
    public ResponseVo<String> addMenuInfo(@RequestBody MenuAddDto MenuAddDto){
        String s = menuService.addMenuInfo(MenuAddDto);
        return ResponseVo.success(s);
    }

    @PostMapping("update-menu-info")
    public ResponseVo<String> updateMenuInfo(@RequestBody MenuUpdateDto MenuUpdateDto){
        String s = menuService.updateMenuInfo(MenuUpdateDto);
        return ResponseVo.success(s);
    }

    @DeleteMapping("delete-menu-info")
    public ResponseVo<String> deleteMenuInfo(@RequestParam("menuId") String MenuId){
        String s = menuService.deleteMenuInfo(MenuId);
        return ResponseVo.success(s);
    }
}
